import React from "react";
import { useSelector, useDispatch } from "react-redux";
import {
  increment,
  decrement,
  incrementAsync,
} from "./store/modules/countSlice";
export default function App() {
  let count = useSelector((state) => state.c1.count);
  const dispatch = useDispatch();
  const incrementHandler = () => {
    dispatch(increment(10));
  };
  const decrementHandler = () => {
    dispatch(decrement(5));
  };
  const decremenAsynctHandler = () => {
    dispatch(incrementAsync(6));
  };
  return (
    <div>
      <h2>{count}</h2>
      <button onClick={incrementHandler}>++</button>
      <button onClick={decrementHandler}>--</button>
      <button onClick={decremenAsynctHandler}>++Async</button>
    </div>
  );
}
